#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,k,q,f[300200],x[600600],y[600600],ans=0;
int t[500500];
int lowbit(int x){return x&-x;}
void add(int a,int b)
{
	for(int i=a;i<=n;i+=lowbit(i)) t[i]+=b;
	return ;
}
int query(int a)
{
	int ans=0;
	for(int i=a;i;i-=lowbit(i)) ans+=t[i];
	return ans;
}
main()
{
	freopen("random.in","r",stdin);
	freopen("random.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>k>>q;
	for(int i=1;i<=n;i++) cin>>f[i];
	for(int i=1;i<=q;i++) cin>>x[i]>>y[i];
	for(int i=1;i<=n;i++) ans+=query(n)-query(f[i]),add(f[i],1);
	cout<<ans<<"\n";
	return 0;
}
